Skip to content

feat(unstable-v2): add session injection schema - #2043

Open
danielkov wants to merge 2 commits into
agentclientprotocol:mainfrom
danielkov:feat/unstable-v2-session-inject
Open

danielkov wants to merge 2 commits into
agentclientprotocol:mainfrom
danielkov:feat/unstable-v2-session-inject

Conversation

@danielkov

@danielkov danielkov commented Aug 26, 2026 •

Copy link
Copy Markdown

Summary

Adds unstable ACP v2 schema for sending user messages to a session that is already running.

  • session/inject accepts content plus queue or steer delivery mode and returns an agent-owned message ID
  • session/revoke_inject cancels a pending message by ID
  • session/replace_inject replaces pending content without changing its ID or queue position
  • session capabilities advertise supported modes, stream behavior, revoke, and replace support
  • delivery uses the existing v2 user_message session update
  • typed errors distinguish unknown, delivered, and unsupported operations
  • all additions are behind unstable_session_inject; stable schema artifacts do not change

Related

@mkorun

mkorun commented Sep 24, 2026

Copy link
Copy Markdown

Sharing some live, empirical data that might be useful here, since this PR is where these semantics actually land in the schema.

We ran a controlled comparison of four CLI coding agents (Codex CLI, Claude Code, OpenCode, Google's Antigravity CLI) against the same steering scenario — a multi-step task, corrected mid-run with "stop after step N, don't do the rest" — and the results map fairly cleanly onto SessionInjectSteerInStream:

  • Codex CLI (its own turn/steer RPC): behaves like interrupt — lands near-instantly, mid-generation.
  • Claude Code: no dedicated steer RPC at all — writing a new user message onto the persistent --input-format stream-json stdin while a turn is running gets folded in live, but only at the next safe boundary, closer to finish than interrupt. This also confirms a concern @SteffenDE raised on the RFD thread (docs(rfd): mid-turn input via session/inject (queue and steer) #1261) about the Claude Agent SDK only generating a message ID at delivery time: there's no separate pending-ack step in the CLI's own mechanism at all, it's a raw stdin write — an ACP adapter really would have to synthesize InjectSessionResponse.messageId itself rather than getting one back synchronously.
  • OpenCode: has genuine mid-turn steering through its own session API too, also finish-like — worth noting since neither OpenCode nor Antigravity come up anywhere in the RFD discussion.
  • Antigravity CLI: no live steering mechanism at all, confirmed directly against the CLI, and no roadmap signal either.

For the two without live steering, our fallback measurements might be useful for gauging how costly the plain queue-after-cancel path actually is in practice: giving the resumed turn the actual correction as its real next prompt (not a generic "continue") correctly handles genuine redirection, not just abort — verified live. It's not free though: it pays for the full prior context again as fresh input, plus real wall-clock restart time (process teardown + reinit) — structural costs, independent of whether the caller times the cancel to land on a clean step boundary.

Happy to share more detail on methodology if it's useful for pinning interrupt/finish against real agent behavior.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants